/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package avenue;

import customers.ListClientForm;
import history.ListPassingHistoryForm;
import history.ListPaymentHistoryForm;
import javax.swing.JMenuItem;
import program.ListProgramForm;
import roles.ListRolesForm;
import tolls.CollectTollForm;
import tolls.PaymentForm;
import users.ListUsersForm;


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 *
 * @author Aggelos
 */
public class Avenue extends javax.swing.JFrame
{

    /**
     * Creates new form Avenue
     */
    public Avenue()
    {
        super.setTitle("Telepass-Main Window");
        LoginForm lf = new LoginForm(this);
        lf.setVisible(true);
        initComponents();
        setExtendedState(Frame.MAXIMIZED_BOTH); //maximise window



    }

    public void printUser()
    {
        if (Session.loginUser != null)
          {
            String userNameStr, stationStr;

            userNameStr = Session.loginUser.getFName() + " " + Session.loginUser.getLName();
            userFiled_Unedit.setText(userNameStr);

            stationStr = Session.loginUser.getStationId().getDescription();
            userStation_Unedit.setText(stationStr);
          }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents()
    {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        userStation_Unedit = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        userFiled_Unedit = new javax.swing.JTextField();
        jMenuBar1 = new javax.swing.JMenuBar();
        administrationMenu = new javax.swing.JMenu();
        usersMenuItem = new javax.swing.JMenuItem();
        clientsMenuItem = new javax.swing.JMenuItem();
        rolesMenuItem = new javax.swing.JMenuItem();
        programsMenuItem = new javax.swing.JMenuItem();
        loginDifUser = new javax.swing.JMenuItem();
        exitMenuItem = new javax.swing.JMenuItem();
        tollsMenu = new javax.swing.JMenu();
        passingMenuItem = new javax.swing.JMenuItem();
        paymentMenuItem = new javax.swing.JMenuItem();
        transactionsMenu = new javax.swing.JMenu();
        cardTransMenuItem = new javax.swing.JMenuItem();
        clientTransMenuItem = new javax.swing.JMenuItem();
        historyMenu = new javax.swing.JMenu();
        passHistoryMenuItem = new javax.swing.JMenuItem();
        paymentHistoryMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowFocusListener(new java.awt.event.WindowFocusListener()
        {
            public void windowGainedFocus(java.awt.event.WindowEvent evt)
            {
                formWindowGainedFocus(evt);
            }
            public void windowLostFocus(java.awt.event.WindowEvent evt)
            {
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabel1.setText("Σταθμός: ");

        userStation_Unedit.setEditable(false);

        jLabel2.setText("Χρήστης: ");

        userFiled_Unedit.setEditable(false);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(userStation_Unedit, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 392, Short.MAX_VALUE)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(userFiled_Unedit, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGap(0, 11, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(userStation_Unedit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(userFiled_Unedit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        administrationMenu.setText("Διαχείριση");

        usersMenuItem.setText("Χρήστες");
        usersMenuItem.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                usersMenuItemActionPerformed(evt);
            }
        });
        administrationMenu.add(usersMenuItem);

        clientsMenuItem.setText("Πελάτες");
        clientsMenuItem.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                clientsMenuItemActionPerformed(evt);
            }
        });
        administrationMenu.add(clientsMenuItem);

        rolesMenuItem.setText("Ρόλοι");
        rolesMenuItem.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                rolesMenuItemActionPerformed(evt);
            }
        });
        administrationMenu.add(rolesMenuItem);

        programsMenuItem.setText("Προγράμματα");
        programsMenuItem.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                programsMenuItemActionPerformed(evt);
            }
        });
        administrationMenu.add(programsMenuItem);

        loginDifUser.setText("Login as different User");
        loginDifUser.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                loginDifUserActionPerformed(evt);
            }
        });
        administrationMenu.add(loginDifUser);

        exitMenuItem.setText("Έξοδος");
        exitMenuItem.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                exitMenuItemActionPerformed(evt);
            }
        });
        administrationMenu.add(exitMenuItem);

        jMenuBar1.add(administrationMenu);

        tollsMenu.setText("Διόδια");

        passingMenuItem.setText("Διέλευση");
        passingMenuItem.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                passingMenuItemActionPerformed(evt);
            }
        });
        tollsMenu.add(passingMenuItem);

        paymentMenuItem.setText("Πληρωμές");
        paymentMenuItem.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                paymentMenuItemActionPerformed(evt);
            }
        });
        tollsMenu.add(paymentMenuItem);

        jMenuBar1.add(tollsMenu);

        transactionsMenu.setText("Κινήσεις");

        cardTransMenuItem.setText("Κίνηση Κάρτας");
        cardTransMenuItem.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                cardTransMenuItemActionPerformed(evt);
            }
        });
        transactionsMenu.add(cardTransMenuItem);

        clientTransMenuItem.setText("Κίνηση Πελάτη");
        clientTransMenuItem.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                clientTransMenuItemActionPerformed(evt);
            }
        });
        transactionsMenu.add(clientTransMenuItem);

        jMenuBar1.add(transactionsMenu);

        historyMenu.setText("Ιστορικό");

        passHistoryMenuItem.setText("Ιστορικό Διελεύσεων");
        passHistoryMenuItem.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                passHistoryMenuItemActionPerformed(evt);
            }
        });
        historyMenu.add(passHistoryMenuItem);

        paymentHistoryMenuItem.setText("Ιστορικό Πληρωμών");
        paymentHistoryMenuItem.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                paymentHistoryMenuItemActionPerformed(evt);
            }
        });
        historyMenu.add(paymentHistoryMenuItem);

        jMenuBar1.add(historyMenu);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(0, 307, Short.MAX_VALUE)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void paymentMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_paymentMenuItemActionPerformed
        // TODO add your handling code here:
        PaymentForm pf = new PaymentForm();
        pf.setVisible(true);
    }//GEN-LAST:event_paymentMenuItemActionPerformed

    private void clientsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clientsMenuItemActionPerformed
        // TODO add your handling code here:
        ListClientForm lcf = new ListClientForm();
        lcf.setVisible(true);
    }//GEN-LAST:event_clientsMenuItemActionPerformed

    private void usersMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usersMenuItemActionPerformed
        // TODO add your handling code here:
        ListUsersForm luf = new ListUsersForm();
        luf.setVisible(true);

    }//GEN-LAST:event_usersMenuItemActionPerformed

    private void rolesMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rolesMenuItemActionPerformed
        // TODO add your handling code here:
        ListRolesForm lrf = new ListRolesForm();
        lrf.setVisible(true);
    }//GEN-LAST:event_rolesMenuItemActionPerformed

    private void passingMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_passingMenuItemActionPerformed
        // TODO add your handling code here:
        CollectTollForm ctf = new CollectTollForm();
        ctf.setVisible(true);
    }//GEN-LAST:event_passingMenuItemActionPerformed

    private void programsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_programsMenuItemActionPerformed
        // TODO add your handling code here:
        ListProgramForm lpf = new ListProgramForm();
        lpf.setVisible(true);
    }//GEN-LAST:event_programsMenuItemActionPerformed

    private void loginDifUserActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_loginDifUserActionPerformed
    {//GEN-HEADEREND:event_loginDifUserActionPerformed
        // TODO add your handling code here:
        LoginForm lf2 = new LoginForm(this);
        lf2.setVisible(true);
    }//GEN-LAST:event_loginDifUserActionPerformed

    private void formWindowGainedFocus(java.awt.event.WindowEvent evt)//GEN-FIRST:event_formWindowGainedFocus
    {//GEN-HEADEREND:event_formWindowGainedFocus
        // TODO add your handling code here:
        printUser();
    }//GEN-LAST:event_formWindowGainedFocus

    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
    System.exit(0);
    }//GEN-LAST:event_exitMenuItemActionPerformed

    private void cardTransMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cardTransMenuItemActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cardTransMenuItemActionPerformed

    private void clientTransMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clientTransMenuItemActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_clientTransMenuItemActionPerformed

    private void passHistoryMenuItemActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_passHistoryMenuItemActionPerformed
    {//GEN-HEADEREND:event_passHistoryMenuItemActionPerformed
        // TODO add your handling code here:
 
        
        ListPassingHistoryForm lpasshf = new ListPassingHistoryForm();
        lpasshf.setVisible(true);
    }//GEN-LAST:event_passHistoryMenuItemActionPerformed

    private void paymentHistoryMenuItemActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_paymentHistoryMenuItemActionPerformed
    {//GEN-HEADEREND:event_paymentHistoryMenuItemActionPerformed
        // TODO add your handling code here:
        ListPaymentHistoryForm lpayhf = new ListPaymentHistoryForm();
        lpayhf.setVisible(true);
    }//GEN-LAST:event_paymentHistoryMenuItemActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[])
    {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try
          {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
              {
                if ("Nimbus".equals(info.getName()))
                  {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                  }
              }
          }
        catch (ClassNotFoundException ex)
          {
            java.util.logging.Logger.getLogger(Avenue.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          }
        catch (InstantiationException ex)
          {
            java.util.logging.Logger.getLogger(Avenue.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          }
        catch (IllegalAccessException ex)
          {
            java.util.logging.Logger.getLogger(Avenue.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          }
        catch (javax.swing.UnsupportedLookAndFeelException ex)
          {
            java.util.logging.Logger.getLogger(Avenue.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          }
        //</editor-fold>

        /* Create and display the form */

        java.awt.EventQueue.invokeLater(new Runnable()
        {
            public void run()
            {
                new Avenue().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu administrationMenu;
    private javax.swing.JMenuItem cardTransMenuItem;
    private javax.swing.JMenuItem clientTransMenuItem;
    private javax.swing.JMenuItem clientsMenuItem;
    private javax.swing.JMenuItem exitMenuItem;
    private javax.swing.JMenu historyMenu;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JMenuItem loginDifUser;
    private javax.swing.JMenuItem passHistoryMenuItem;
    private javax.swing.JMenuItem passingMenuItem;
    private javax.swing.JMenuItem paymentHistoryMenuItem;
    private javax.swing.JMenuItem paymentMenuItem;
    private javax.swing.JMenuItem programsMenuItem;
    private javax.swing.JMenuItem rolesMenuItem;
    private javax.swing.JMenu tollsMenu;
    private javax.swing.JMenu transactionsMenu;
    private javax.swing.JTextField userFiled_Unedit;
    private javax.swing.JTextField userStation_Unedit;
    private javax.swing.JMenuItem usersMenuItem;
    // End of variables declaration//GEN-END:variables

    public JMenuItem getjMenuItem1()
    {
        return clientsMenuItem;
    }

    public void setjMenuItem1(JMenuItem jMenuItem1)
    {
        this.clientsMenuItem = jMenuItem1;
    }

    public JMenuItem getjMenuItem2()
    {
        return passingMenuItem;
    }

    public void setjMenuItem2(JMenuItem jMenuItem2)
    {
        this.passingMenuItem = jMenuItem2;
    }

    public JMenuItem getjMenuItem3()
    {
        return usersMenuItem;
    }

    public void setjMenuItem3(JMenuItem jMenuItem3)
    {
        this.usersMenuItem = jMenuItem3;
    }

    public JMenuItem getjMenuItem4()
    {
        return paymentMenuItem;
    }

    public void setjMenuItem4(JMenuItem jMenuItem4)
    {
        this.paymentMenuItem = jMenuItem4;
    }

    public JMenuItem getjMenuItem5()
    {
        return cardTransMenuItem;
    }

    public void setjMenuItem5(JMenuItem jMenuItem5)
    {
        this.cardTransMenuItem = jMenuItem5;
    }

    public JMenuItem getjMenuItem6()
    {
        return clientTransMenuItem;
    }

    public void setjMenuItem6(JMenuItem jMenuItem6)
    {
        this.clientTransMenuItem = jMenuItem6;
    }

    public JMenuItem getjMenuItem7()
    {
        return rolesMenuItem;
    }

    public void setjMenuItem7(JMenuItem jMenuItem7)
    {
        this.rolesMenuItem = jMenuItem7;
    }

    public JMenuItem getjMenuItem8()
    {
        return programsMenuItem;
    }

    public void setjMenuItem8(JMenuItem jMenuItem8)
    {
        this.programsMenuItem = jMenuItem8;
    }
}
